﻿using System;
using System.Collections.Generic;

namespace Program20
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入用户名：");
            var name = Console.ReadLine();
            Console.WriteLine("请输入密码：");
            var pwd = Console.ReadLine();

            var msg = "";

            var status = Login(name, pwd, out msg);
            Console.WriteLine("登陆结果为{0},提醒{1}", status, msg);
        }
        public static bool Login(string name, string pwd, out string statusMessage)
        {
            statusMessage = "登陆失败";

            if (string .IsNullOrEmpty(name ))
            {
                statusMessage = "用户名不能为空";
                return false;
            }

            if (string.IsNullOrEmpty(name ))
            {
                statusMessage = "用户密码不能为空";
                return false;
            }

            //检测是否存在此用户
            var users = new List<string>();
            users.Add("c罗");
            if (!users.Contains(name))
            {
                statusMessage = "此用户不存在,请重试";
                return false;
            }


            //检测口令是否正确
            if (name == "c罗" &&  pwd == "123456")
            {
                statusMessage = "登录成功lala";
                return true;
            }
            else 
            {
                statusMessage = "登陆失败。请重试";
                return false;
            }
         
        }

    }
}
